package com.action;

import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.service.UserService;

@Controller
@Transactional
public class ListUserAction extends ActionSupport {
	
	@Resource private UserService userservice;

	private static final long serialVersionUID = 1L;

	public String execute() {			
		// HttpServletRequest request = (HttpServletRequest)
		// context.get(ServletActionContext.HTTP_REQUEST);
		// Map session = context.getSession(); //获取sesion
		ActionContext context = ActionContext.getContext();// 获取action上下文
		//HttpServletResponse response=(HttpServletResponse)context.get(ServletActionContext.HTTP_RESPONSE);
		//HttpServletRequest request=(HttpServletRequest)context.get(ServletActionContext.HTTP_REQUEST);
		context.put("users", userservice.list());
		return SUCCESS;	
	}

}
